  <!-- <div>
    <h1>1111促销管理</h1>
  </div> -->
<template>
  <div>
    <!-- 促销管理页面，1表 -->
    <div id="cxgl">
      <div id="cx_sxcx">
        <div id="cx_sxcx_header" class="clear">
          <div>筛选查询</div>
          <div id="sq" @click="sq">收起 ∧ </div>
          <div id="zk" @click="zk" class="yc">展开 ∨ </div>
        </div>
        <div id="cx_sxcx_content" class="clear">
          <div>
            <label for="">标题关键词</label>
            <el-input v-model="searchFrom.cxbt" placeholder="请输入内容"></el-input>
          </div>
          <div>
            <label for="">状态</label>
            <el-select v-model="searchFrom.sfsj" placeholder="请选择">
              <el-option v-for="(item,i) in options" :key="i" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </div>
          <div>
            <label for="">行程类型</label>
            <el-select v-model="searchFrom.syxc" placeholder="请选择">
              <el-option v-for="(item,i) in options_2" :key="i" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </div>
          <!-- <div class="block">
            <label for="" class="demonstration">添加时间</label>
            <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="searchFrom.tjsj" type="datetime" placeholder="请选择时间">
            </el-date-picker>
          </div> -->
        </div>
        <div id="cx_sxcx_footer">
          <button @click="cz">重置</button>
          <button @click="sx">筛选</button>
        </div>
      </div>
      <div id="cx_sjlb">
        <div id="cx_sjlb_header" class="clear">
          <div>数据列表</div>
          <div id="cx_sjlb_header_right" class="clear">
            <!-- <div>
              <label for="">排序方式</label>
              <select name="" id="">
                <option value="">全部</option>
                <option value="">按时间顺序</option>
                <option value="">按时间倒序</option>
              </select>
            </div> -->
            <div>
              <!-- <label for="">批量操作</label>
              <select name="" id="">
                <option value="">全部</option>
                <option value="">可删除</option>
              </select>  -->
              <!-- <button>添加</button> -->
              <el-button @click="spgl(this)">商品管理</el-button>
              <el-button type="button" @click="tjtk_cx = true">添加</el-button>
            </div>
          </div>
        </div>
        <div id="cx_sjlb_content">
          <el-table :data="tableData_1" border style="width: 100%" :default-sort="{prop: 'id', order: 'ascendant'}">
            <!-- <el-table-column type="selection" width="auto" min-width="3%">
            </el-table-column> -->
            <el-table-column prop="id" label="ID" width="auto" min-width="5%">
            </el-table-column>
            <el-table-column prop="cxbt" label="促销标题" width="auto" min-width="9%" sortable>
            </el-table-column>
            <el-table-column prop="cxxq" label="促销详情" width="auto" min-width="25%" sortable>
            </el-table-column>
            <el-table-column prop="syxc" label="使用行程" width="auto" min-width="18%" sortable>
            </el-table-column>
            <el-table-column prop="sfsj" label="是否上架" width="auto" min-width="11%" sortable>
              <template slot-scope="scope">
                <el-switch active-color="#409EFF" inactive-color="#C0CCDA" v-model="scope.row.sfsj" @change="cxglsfsj(scope.row)"></el-switch>
              </template>
            </el-table-column>
            <el-table-column label="添加日期" width="auto" min-width="14%" sortable>
              <template slot-scope="scope">{{ scope.row.tjsj }}</template>
            </el-table-column>
            <el-table-column label="操作" width="auto" min-width="15%">
              <div slot-scope="scope">
                <el-button type="text" size="small" @click="bjData_1(scope.row)">编辑</el-button>
                <el-button type="text" size="small" @click="sctk_1(scope.row)">删除</el-button>
              </div>
            </el-table-column>
          </el-table>
        </div>
        <div id="cx_sjlb_footer">
          <div class="block">
            <el-pagination @size-change="handleSizeChange_1" @current-change="handleCurrentChange" :page-sizes="[5, 10, 15, 20]" layout="total, sizes, prev, pager, next, jumper" :total="cxglData.length" :page-size='5' :current-page.sync="nowPage_1">
            </el-pagination>
          </div>
          <!-- <el-pagination background layout="prev, pager, next" :total="cxglData.length" :page-size="nowNum_1" :current-page.sync="nowPage_1">
          </el-pagination> -->
        </div>
      </div>
    </div>
    <!-- 商品管理页面，2表 -->
    <div id="spgl" class="yc">
      <div id="spgl_header" class="clear">
        <div>商品管理</div>
        <div id="spgl_header_right" class="clear">
          <!-- <div>
            <label for="">排序方式</label>
            <select name="" id="">
              <option value="">全部</option>
              <option value="">按时间顺序</option>
              <option value="">按时间倒序</option>
            </select>
          </div> -->
          <el-button type="button" @click="tjtk_sp = true">添加</el-button>
          <el-button @click="cxgl">返回</el-button>
        </div>
      </div>
      <div id="spgl_content">
        <el-table :data="tableData_2" border style="width: 100%">
          <!-- <el-table-column type="selection" width="auto" min-width="3%">
          </el-table-column> -->
          <el-table-column prop="id" label="序号" width="auto" min-width="5%">
          </el-table-column>
          <el-table-column prop="sptp" label="商品图片" width="auto" min-width="13%">
            <div style="width:130px;height:78px;text-align:center;">
              <img src="	http://localhost:8080/getImg?sort=assets/image/Women/Skirt3.jpg" style="width:98px;background-repeat:no-repeat;background-size:cover;overflow:hidden;" alt="">
              <!-- server\public\assets\image\Children\Shoes1.jpg -->
            </div>
          </el-table-column>
          <el-table-column prop="spmc" label="商品名称" width="auto" min-width="13%">
          </el-table-column>
          <el-table-column prop="hh" label="货号" width="auto" min-width="10%">
          </el-table-column>
          <el-table-column prop="jg" label="价格" width="auto" min-width="10%">
          </el-table-column>
          <el-table-column prop="fl" label="分类" width="auto" min-width="10%">
          </el-table-column>
          <el-table-column prop="xl" label="销量" width="auto" min-width="7%">
          </el-table-column>
          <el-table-column prop="wz" label="位置" width="auto" min-width="7%">
          </el-table-column>
          <el-table-column prop="sfsj" label="是否上架" width="auto" min-width="7%">
            <template slot-scope="scope">
              <el-switch active-color="#409EFF" inactive-color="#C0CCDA" v-model="scope.row.sfsj" @change="spglsfsj(scope.row)"></el-switch>
            </template>
          </el-table-column>

          <el-table-column label="操作" width="auto" min-width="13%">
            <div slot-scope="scope">
              <el-button type="text" size="small" @click="bjData_2(scope.row)">编辑</el-button>
              <el-button type="text" size="small" @click="sctk_2(scope.row)">删除</el-button>
            </div>
          </el-table-column>
        </el-table>
      </div>
      <div id="cx_sjlb_footer">
        <div class="block">
          <el-pagination @size-change="handleSizeChange_2" @current-change="handleCurrentChange" :page-sizes="[5, 10, 15, 20]" layout="total, sizes, prev, pager, next, jumper" :total="spglData.length" :page-size='5' :current-page.sync="nowPage_2">
          </el-pagination>
        </div>
        <!-- <el-pagination background layout="prev, pager, next" :total="spglData.length" :page-size="nowNum_2" :current-page.sync="nowPage_2">
        </el-pagination> -->
      </div>
    </div>
    <!-- 促销添加弹框 -->
    <div id="tjtk_1">
      <el-dialog title="添加促销" :visible.sync="tjtk_cx" width="70%" :before-close="tkgb_cx">
        <el-form :model="form_cx" ref="form_cx" label-width="130px">
          <el-form-item label="促销标题" prop="cxbt">
            <el-input v-model="form_cx.cxbt"></el-input>
          </el-form-item>
          <el-form-item label="促销详情" prop="cxxq">
            <el-input v-model="form_cx.cxxq"></el-input>
          </el-form-item>
          <el-form-item label="使用行程类型" prop="syxc">
            <el-radio-group v-model="form_cx.syxc">
              <el-radio label="徒步"></el-radio>
              <el-radio label="跑步"></el-radio>
              <el-radio label="骑行"></el-radio>
              <el-radio label="自驾"></el-radio>
              <el-radio label="其他"></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="促销商品" prop="cxsp">
            <el-input v-model="form_cx.cxsp"></el-input>
          </el-form-item>
          <el-form-item label="促销货号" prop="cxhh">
            <el-input v-model="form_cx.cxhh"></el-input>
          </el-form-item>
          <el-form-item label="开始时间" prop="kssj">
            <el-date-picker v-model="form_cx.kssj" type="datetime" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd HH:mm:ss">
            </el-date-picker>
            <!-- <el-input v-model="form_cx.kssj"></el-input> -->
          </el-form-item>
          <el-form-item label="上架" prop="sfsj">
            <el-switch v-model="form_cx.sfsj"></el-switch>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="cxtj('form_cx')">提交</el-button>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>
    <!-- 商品添加弹框 -->
    <div id="tjtk_2">
      <el-dialog title="添加商品" :visible.sync="tjtk_sp" width="70%" :before-close="tkgb_sp">
        <el-form :model="form_sp" ref="form_sp" label-width="130px">
          <el-form-item label="商品名称" prop="spmc">
            <el-input v-model="form_sp.spmc"></el-input>
          </el-form-item>
          <el-form-item label="货号" prop="hh">
            <el-input v-model="form_sp.hh"></el-input>
          </el-form-item>
          <el-form-item label="价格" prop="jg">
            <el-input v-model="form_sp.jg"></el-input>
          </el-form-item>
          <el-form-item label="分类" prop="fl">
            <el-input v-model="form_sp.fl"></el-input>
          </el-form-item>
          <el-form-item label="销量" prop="xl">
            <el-input v-model="form_sp.xl"></el-input>
          </el-form-item>
          <el-form-item label="位置" prop="wz">
            <el-input v-model="form_sp.wz"></el-input>
          </el-form-item>
          <el-form-item label="上架" prop="sfsj">
            <el-switch v-model="form_sp.sfsj"></el-switch>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="sptj('form_sp')">提交</el-button>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>
    <!-- 促销编辑弹框 -->
    <div id="bjtk_1">
      <el-dialog title="编辑促销" :visible.sync="bjtk_cx" width="70%" :before-close="tkgb_cx">
        <el-form :model="form_cx" ref="form_cx" label-width="130px">
          <el-form-item label="促销标题" prop="cxbt">
            <el-input v-model="form_cx.cxbt"></el-input>
          </el-form-item>
          <el-form-item label="促销详情" prop="cxxq">
            <el-input v-model="form_cx.cxxq"></el-input>
          </el-form-item>
          <el-form-item label="适用行程类型" prop="syxc">
            <el-radio-group v-model="form_cx.syxc">
              <el-radio label="徒步"></el-radio>
              <el-radio label="跑步"></el-radio>
              <el-radio label="骑行"></el-radio>
              <el-radio label="自驾"></el-radio>
              <el-radio label="其他"></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="促销商品" prop="cxsp">
            <el-input v-model="form_cx.cxsp"></el-input>
          </el-form-item>
          <el-form-item label="商品货号" prop="cxhh">
            <el-input v-model="form_cx.cxhh"></el-input>
          </el-form-item>
          <el-form-item label="开始时间" prop="kssj">
            <el-date-picker v-model="form_cx.kssj" type="datetime" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd HH:mm:ss">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="上架" prop="sfsj">
            <el-switch v-model="form_cx.sfsj"></el-switch>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="cxbj">提交</el-button>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>
    <!-- 商品添加弹框 -->
    <div id="bjtk_2">
      <el-dialog title="编辑商品" :visible.sync="bjtk_sp" width="70%" :before-close="tkgb_sp">
        <el-form :model="form_sp" ref="form_sp" label-width="130px">
          <el-form-item label="商品名称" prop="spmc">
            <el-input v-model="form_sp.spmc"></el-input>
          </el-form-item>
          <el-form-item label="货号" prop="hh">
            <el-input v-model="form_sp.hh"></el-input>
          </el-form-item>
          <el-form-item label="价格" prop="jg">
            <el-input v-model="form_sp.jg"></el-input>
          </el-form-item>
          <el-form-item label="分类" prop="fl">
            <el-input v-model="form_sp.fl"></el-input>
          </el-form-item>
          <el-form-item label="销量" prop="xl">
            <el-input v-model="form_sp.xl"></el-input>
          </el-form-item>
          <el-form-item label="位置" prop="wz">
            <el-input v-model="form_sp.wz"></el-input>
          </el-form-item>
          <el-form-item label="上架" prop="sfsj">
            <el-switch v-model="form_sp.sfsj"></el-switch>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="spbj">提交</el-button>
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>
  </div>
</template>
<style lang="less" scoped>
// * {
//   transition: 1s linear all;
//   padding: 0;
//   margin: 0;
// }
.clear::after {
  content: "";
  display: block;
  clear: both;
}
.yc {
  display: none;
}
#sq,
#zk {
  cursor: pointer;
}
#sq:hover,
#zk:hover {
  color: #409eff;
}
/* #cxgl {
  background-color: rgb(250, 250, 250);
  font-size: 12px;
} */
#cxgl > div,
#spgl > div {
  border: 1px solid #dcdfe6;
  font-size: 15px;
}
button {
  cursor: pointer;
}
#cx_sxcx > div {
  padding: 15px;
}
#cx_sxcx_header {
  background-color: rgb(242, 242, 242);
}
#cx_sxcx_header > div:nth-child(1) {
  float: left;
}
#cx_sxcx_header > :not(div:nth-child(1)) {
  float: right;
  margin-right: 40px;
}
#cx_sxcx_content > div {
  float: left;
  width: 30%;
}
#cx_sxcx_content > div:nth-child(2) {
  margin: 0 5%;
}
#cx_sxcx_content > div > :nth-last-child(1) {
  padding: 5px;
  width: 50%;
  margin-left: 15px;
}
#cx_sxcx_footer > button {
  padding: 10px 40px;
  border: none;
  color: white;
  background-color: rgb(102, 102, 102);
  border-radius: 5px;
}
#cx_sxcx_footer > button:nth-child(1) {
  background-color: rgb(204, 204, 204);
  margin: 0 5% 0 30%;
}
#cx_sjlb,
#spgl {
  background: rgb(242, 242, 242);
  margin-top: 10px;
}
#cx_sjlb > div,
#spgl > div {
  padding: 15px;
}
#cx_sjlb_header > div:nth-child(1),
#spgl_header > div:nth-child(1) {
  float: left;
}
#cx_sjlb_header_right,
#spgl_header_right {
  float: right;
}
#cx_sjlb_header_right > div,
#spgl_header_right > div {
  float: left;
}
#cx_sjlb_header_right > div:nth-child(2),
#spgl_header_right > div:nth-child(2) {
  margin: 0 10px;
}
#cx_sjlb_header_right > div > select,
#spgl_header_right > div > select {
  margin: 0 10px;
  padding: 6px;
  border: none;
  border-radius: 5px;
  width: 120px;
}
#cx_sjlb_header_right button,
#spgl_header_right > button {
  background: white;
  border: 1px solid rgb(204, 204, 204);
  padding: 5px 30px;
  margin-left: 10px;
}
/deep/ .el-table .cell,
/deep/ .el-table--border .el-table__cell:first-child .cell,
/deep/ .el-pagination {
  text-align: center;
}
</style>

<script>
export default {
  data() {
    return {
      options: [{/* 1表筛选查询，状态选择 */
        value: '全部',
        label: ''
      }, {
        value: '上架',
        label: ''
      }, {
        value: '下架',
        label: ''
      }],
      options_2: [{/* 1表筛选查询，行程类型选择 */
        value: '全部',
        label: ''
      }, {
        value: '徒步',
        label: ''
      }, {
        value: '跑步',
        label: ''
      }, {
        value: '骑行',
        label: ''
      }, {
        value: '自驾',
        label: ''
      }, {
        value: '其他',
        label: ''
      }],
      searchFrom: {/* 1表查询临时表单 */
        cxbt: '',
        cxsp: '',
        sfsj: '全部',
        syxc: '全部'
      },
      value: '',
      input: '',/* 查询，输入框 */
      cxglData: [],
      spglData: [],
      nowPage_1: 1,/* 当前页 */
      nowPage_2: 1,
      eachNum_1: '每页5条',
      eachNum_2: '每页5条',
      nowNum_1: 5,/* 每页显示几条数据 */
      nowNum_2: 5,
      tjtk_cx: false,/* 1表添加弹框 */
      tjtk_sp: false,
      form_cx: {/* 1表添加编辑临时表单 */
        cxbt: '',
        cxxq: '',
        syxc: '',
        cxsp: '',
        cxhh: '',
        kssj: '',
        sfsj: false,
      },
      form_sp: {
        spmc: '',
        hh: '',
        jg: '',
        fl: '',
        xl: '',
        wz: '',
        sfsj: false,
      },
      bjtk_cx: false,/* 1表编辑弹框 */
      bjtk_sp: false
    }
  },
  methods: {
    handleSizeChange_1(val) {
      // console.log(`每页 ${val} 条`);
      this.eachNum_1 = `每页 ${val} 条`
      this.nowNum_1 = val
      return
    },
    handleSizeChange_2(val) {
      // console.log(`每页 ${val} 条`);
      this.eachNum_2 = `每页 ${val} 条`
      this.nowNum_2 = val
      return
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
    },
    spgl() {/* 隐藏促销管理页面，显示商品管理页面 */
      document.querySelector("#cxgl").classList.add('yc')
      document.querySelector("#spgl").classList.remove('yc')
    },
    cxgl() {/* 上反之 */
      document.querySelector("#cxgl").classList.remove('yc')
      document.querySelector("#spgl").classList.add('yc')
    },
    sq() {/* 筛选收起 */
      document.querySelector("#cx_sxcx_content").classList.add('yc')
      document.querySelector("#cx_sxcx_footer").classList.add('yc')
      document.querySelector("#sq").classList.add('yc')
      document.querySelector("#zk").classList.remove('yc')
    },
    zk() {/* 筛选展开 */
      document.querySelector("#cx_sxcx_content").classList.remove('yc')
      document.querySelector("#cx_sxcx_footer").classList.remove('yc')
      document.querySelector("#sq").classList.remove('yc')
      document.querySelector("#zk").classList.add('yc')
    },
    getallcxgl(data = {}) {/* 1表刷新所有数据 */
      this.$axios({
        url: '/promotion/getallcxgl',
        method: 'get',
        params: data
      }).then((res) => {
        let data = res.data.data;
        data.filter((v) => {
          v.tjsj = this.dateFn(v.tjsj);
          if (v.sfsj == '是') {
            v.sfsj = true;
          } else {
            v.sfsj = false;
          };
        });
        this.cxglData = data;
        this.form_cx = {
          cxbt: '',
          cxxq: '',
          syxc: '',
          cxsp: '',
          cxhh: '',
          kssj: '',
          sfsj: false,
        }
      })
    },
    getallspgl() {/* 2表刷新所有数据 */
      this.$axios({
        url: '/promotion/getallspgl',
        method: 'get'
      }).then((res) => {
        let data = res.data.data;
        // console.log(data);
        data.filter((v) => {
          if (v.sfsj == '是') {
            v.sfsj = true;
          } else {
            v.sfsj = false;
          };
        });
        this.spglData = data;
        this.form_sp = {
          spmc: '',
          hh: '',
          jg: '',
          fl: '',
          xl: '',
          wz: '',
          sfsj: false,
        }
      })
    },
    cxglsfsj(val) {/* 1表是否上架滑动开关 */
      if (val.sfsj) {
        val.sfsj = '是'
      } else {
        val.sfsj = '否'
      }
      // console.log(val);
      this.$axios({
        url: '/promotion/cxglsfsj',
        method: 'post',
        data: val
      }).then(() => {
        if (val.sfsj == '是') {
          this.$message({
            message: '上架成功',
            type: 'success'
          });
        } else {
          this.$message({
            message: '下架成功',
            type: 'warning'
          });
        }
        this.getallcxgl()
      })
    },
    spglsfsj(val) {/* 2表是否上架滑动开关 */
      if (val.sfsj) {
        val.sfsj = '是'
      } else {
        val.sfsj = '否'
      }
      // console.log(val);
      this.$axios({
        url: '/promotion/spglsfsj',
        method: 'post',
        data: val
      }).then(() => {
        if (val.sfsj == '是') {
          this.$message({
            message: '上架成功',
            type: 'success'
          });
        } else {
          this.$message({
            message: '下架成功',
            type: 'warning'
          });
        }
        this.getallspgl()
      })
    },
    sctk_1(data) {/* 1表删除提示弹框 */
      this.$confirm('确认删除该信息？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.del_1(data);
      })
    },
    del_1(data) {/* 1表数据删除方法 */
      this.$axios({
        url: '/promotion/cxglsc',
        method: 'post',
        data: data
      }).then(() => {
        this.getallcxgl();
      })
    },
    sctk_2(data) {/* 2表删除提示弹框 */
      this.$confirm('确认删除该信息？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.del_2(data);
      })
    },
    del_2(data) {/* 2表数据删除方法 */
      this.$axios({
        url: '/promotion/spglsc',
        method: 'post',
        data: data
      }).then(() => {
        this.getallspgl();
      })
    },
    cxtj(formName) {/* 1表添加弹框 */
      if (this.form_cx.sfsj) {
        this.form_cx.sfsj = '是'
      } else {
        this.form_cx.sfsj = '否';
      }
      this.$axios({
        url: '/promotion/cxgltj',
        method: 'post',
        data: this.form_cx
      }).then((res) => {
        this.tjtk_cx = false;
        this.getallcxgl();
      })
    },
    sptj(formName) {/* 2表添加弹框 */
      if (this.form_sp.sfsj) {
        this.form_sp.sfsj = '是'
      } else {
        this.form_sp.sfsj = '否';
      }
      this.$axios({
        url: '/promotion/spgltj',
        method: 'post',
        data: this.form_sp
      }).then((res) => {
        this.tjtk_sp = false;
        this.getallspgl();
      })
    },
    tkgb_cx(done) {/* 1表添加弹框关闭提示 */
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
        })
        .catch(_ => { });
    },
    tkgb_sp(done) {/* 2表添加弹框关闭提示 */
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
        })
        .catch(_ => { });
    },
    bjData_1(data) {/* 1表编辑弹框数据传递 */
      this.bjtk_cx = true;
      this.form_cx = { ...data };
    },
    cxbj(res) {/* 1表确认编辑 */
      this.$axios({
        url: '/promotion/cxglbj',
        method: 'post',
        data: this.form_cx
      }).then(() => {
        this.bjtk_cx = false;
        this.getallcxgl();
      })
    },
    bjData_2(data) {/* 2表编辑弹框数据传递 */
      this.bjtk_sp = true;
      this.form_sp = { ...data };
    },
    spbj(res) {/* 2表确认编辑 */
      this.$axios({
        url: '/promotion/spglbj',
        method: 'post',
        data: this.form_sp
      }).then(() => {
        this.bjtk_sp = false;
        this.getallspgl();
      })
    },
    sx() {/* 1表筛选 */
      let from = { ...this.searchFrom };
      if (from.sfsj == '上架') {
        from.sfsj = '是';
      } else if (from.sfsj == '下架') {
        from.sfsj = '否'
      }
      this.getallcxgl(from);
    },
    cz() {/* 1表重置 */
      this.searchFrom = {
        cxbt: '',
        cxsp: '',
        sfsj: '全部',
        syxc: '全部'
      }
      this.getallcxgl();
    },
    dateFn(daytime) {/* 时间格式修改 */
      daytime = daytime.replace(/.000Z/g, " ");
      daytime = daytime.split("T");
      let day = daytime[0];
      let time = daytime[1].split(":");
      time = `${parseInt(time[0]) + 8}` + ":" + time[1] + ":" + time[2];
      return day + " " + time;
    }
  },
  mounted() {/* 默认运行数据刷新 */
    this.getallcxgl();
    this.getallspgl();
  },
  computed: { /* 计算页码数 */
    tableData_1() {
      // return this.cxglData.slice((this.nowPage_1 - 1) * this.nowNum_1, this.nowPage_1 * this.nowNum_1);
      return this.cxglData.slice(
        (this.nowPage_1 - 1) * this.eachNum_1.replace(/[^0-9]/ig, ""),
        this.nowPage_1 * this.eachNum_1.replace(/[^0-9]/ig, ""),
        (this.nowPage_1 - 1) * this.nowNum_1, this.nowPage_1 * this.nowNum_1);
    },
    tableData_2() {
      // return this.spglData.slice((this.nowPage_2 - 1) * this.nowNum_2, this.nowPage_2 * this.nowNum_2);
      return this.spglData.slice(
        (this.nowPage_2 - 1) * this.eachNum_2.replace(/[^0-9]/ig, ""),
        this.nowPage_2 * this.eachNum_2.replace(/[^0-9]/ig, ""),
        (this.nowPage_2 - 1) * this.nowNum_2, this.nowPage_2 * this.nowNum_1);
    }
  },
}
</script>


